﻿@page "/"
@using BootstrapBlazorApp.OnlyServer.Shared
@attribute [TabItemOption(Text = "Index", Closable = false)]
<PageTitle>Index</PageTitle>

<h1>Hello, world!</h1>
Welcome to your new app.

<SurveyPrompt Title="How is Blazor working for you?" />

<Select @bind-Value="Value1" DisableItemChangedWhenFirstRender="true" OnSelectedItemChanged="OnSelectedItemChanged"></Select>

<DatePickerBody @bind-Value="Ld"
                ShowLunar="true"
                ShowFestivals="true"
                ShowHolidays="true" />

<DateTimePicker @bind-Value="LoadingDate" 
                ViewMode="DatePickerViewMode.DateTime" 
                ShowLunar="true"
                IsEditable="true"
                ShowFestivals="true"
                ShowHolidays="true"
                DateTimeFormat="yyyy-MM-dd HH:mm" />
@code{
    DateTime Ld { get; set; } = DateTime.Today;
    DateTime? LoadingDate{ get; set; }

    string Value1{ get; set; }

    Task OnSelectedItemChanged(SelectedItem selectedItem)
    {
        return Task.CompletedTask;
    }

    private List<Foo> _items = default!;

    private Task<QueryData<Foo>> OnQueryAsync(QueryPageOptions options)
    {
        // 此处代码拷贝后需要自行更改根据 options 中的条件从数据库中获取数据集合
        return Task.FromResult(new QueryData<Foo>()
            {
                Items = _items
            });
    }
}